package com.msa.msaportal.common.web;

import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
/**
 * 
* @ClassName: WebserviceUtils 
* @Description: TODO(Webservice 工具类) 
* @Company:大连海大
* @author zhaolei 
* @version 1.0 2016-8-4 上午10:44:53
 */
public class WebserviceUtils {
	/**
	 * 
	*
	* @Title: getInfoByCxf 
	* @Description: TODO(远程调用webservice服务方法) 
	* @param @param url
	* @param @param method
	* @param @param param
	* @param @return
	* @param @throws Exception    设定文件 
	* @return String    返回类型 
	* @throws
	 */
	public static String getInfoByCxf(String url,String method,String param) throws Exception{
			
			JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
	    	Client client = clientFactory.createClient(url);
	
	    	Object[] result = client.invoke(method, param);
	    	
	    	return (String)result[0];
		}
public static void main(String[] args) throws Exception {
	String json = "{'userId':'14260197911261329','templateId': '1114'}";
	String result=WebserviceUtils.getInfoByCxf("http://172.16.16.199:9001/RMS/NavigationServicesService?wsdl", "queryNavigation", json);
	System.out.println("result: "+result);
}
}
